package riceSystem.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import riceSystem.dao.DaoTemplateInterface;
import riceSystem.entity.Activity;
import riceSystem.exception.RunException;
import riceSystem.service.ServiceTemplateInterface;
/**
 * 活动的service
 * @author zhangyi
 *
 */
@Component("activityService")
public class ActivityServiveImpl implements ServiceTemplateInterface<Activity> {
	
	private DaoTemplateInterface<Activity> activityDao;
	
	public DaoTemplateInterface<Activity> getActivityDao() {
		return activityDao;
	}
	@Resource(name="activityDao")
	public void setActivityDao(DaoTemplateInterface<Activity> activityDao) {
		this.activityDao = activityDao;
	}
	public void add(Activity t) throws RunException {
		activityDao.save(t);
	}
	public void removeById(long id) throws RunException {
		activityDao.deleteById(id);
	}
	public void remove(Activity t) throws RunException {
		activityDao.delete(t);
	}
	public long update(Activity t) throws RunException {
		return activityDao.update(t);
	}
	public Activity getById(long id) throws RunException {
		return activityDao.loadById(id);
	}
	public List<Activity> getAll() throws RunException {
		return activityDao.loadAll();
	}
}
